//
//  UIColor+WXUtility.m
//  CommonFramework
//
//  Created by leev on 2017/10/24.
//  Copyright © 2017年 XES. All rights reserved.
//

#import "UIColor+WXUtility.h"

@implementation UIColor (WXUtility)

/**
 * @desc 根据十六进制初始化UIColor
 *
 * @param hexValue 十六进制数, 例如:0xa0a0a0
 *
 */
+ (UIColor *)colorWithHexValue:(NSInteger)hexValue alpha:(CGFloat)alpha
{
    return [UIColor colorWithRed:((CGFloat)((hexValue & 0xFF0000) >> 16)) / 255.0f
                           green:((CGFloat)((hexValue & 0xFF00) >> 8)) / 255.0f
                            blue:((CGFloat)(hexValue & 0xFF)) / 255.0f
                           alpha:alpha];
}

/**
 * @desc 根据十六进制初始化UIColor, 默认 alpha = 1.0f
 *
 * @param hexValue 十六进制数, 例如:0xa0a0a0
 *
 */
+ (UIColor *)colorWithHexValue:(NSInteger)hexValue
{
    return [self colorWithHexValue:hexValue alpha:1.0f];
}

/** 主题色(网校红) */
+ (UIColor *)wxThemeColorWithAlpha:(CGFloat)alpha
{
    return [self colorWithHexValue:0xff4343 alpha:alpha];
}

/** 字体灰  */
+(UIColor *)wxFontGrayColor
{
    return [self colorWithHexValue:0x333333];
}

/** 字体浅灰 #666666 */
+(UIColor *)wxFontLightGrayColor
{
    return [self colorWithHexValue:0x666666];
}

/** 背景灰 */
+(UIColor *)wxBackGroundGrayColor
{
    return [self colorWithHexValue:0xEEEEEE];
}

@end
